package com.lh.serverforwebrtc.service.impl;

import com.lh.serverforwebrtc.bean.UserStatusBean;
import com.lh.serverforwebrtc.mapper.UserStatusMapper;
import com.lh.serverforwebrtc.service.UserStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: Lh
 * @Description:
 * @Date: Created in 17:44 2022/6/20
 */
@Service
public class UserStatusServiceImpl implements UserStatusService {

    @Autowired
    private UserStatusMapper userStatusMapper;

    @Override
    public UserStatusBean queryUserStatusByid(int id) {
        return null;
    }

    @Override
    public void addOnlineUser(UserStatusBean userStatusBean) {
        UserStatusBean usb = userStatusMapper.queryUserStatusById(userStatusBean.getId());
       if(usb==null) userStatusMapper.addOnlineUser(userStatusBean);
    }

    @Override
    public void removeOnlineUser(int id) {
        userStatusMapper.removeOnlineUser(id);
    }

    @Override
    public List<UserStatusBean> getOnLineUser() {
        return userStatusMapper.findAll();
    }

}
